<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/login.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
</head>


<style>
    html,body{
        background-color: #f1f5f9;
    }
    .container-login{
        margin: 240px auto;
        width: 50%;
        display: flex;
        justify-content:space-between;
        align-items: center;
    }
    .login-dialog{
        width: 400px;
        height: 300px;
        padding-top: 20px;
        border-radius: 10px;
        border: 1px gray solid;
        background-color: white;
    }
    .login-dialog h3{
        text-align: center;

    }
    .login-dialog .row{
        width: 300px;
        height: 40px;
        margin: 10px auto;
        display: flex;
        justify-content: space-between;
        align-items: center;

    }

    .login-dialog .row>input{
        width: 220px;
        height: 35px;
        border: gray solid 1px;
        border-radius: 5px;
        /* border: none; */
        outline: none;
        padding-left: 10px;
    }
    .login-dialog button{
        width: 300px;
        color: white;
        border: none;
    }
</style>


<body>
<div class="container-login">
    <div class="container-pic">
        <img src="pic/computer.png" width="350px">
    </div>
    <div class="login-dialog">
        <h3>登陆</h3>
        <div class="row">
            <span>用户名</span>
            <input type="text" name="userName" id="userName" class="form-control">
        </div>
        <div class="row">
            <span>密码</span>
            <input type="password" name="password" id="password" class="form-control">
        </div>
        <div class="row">
            <button type="button" class="btn btn-info btn-lg" onclick="login()">登录</button>
        </div>
    </div>
</div>
<script src="js/jquery.min.js"></script>
<script>
    function login() {
        $.ajax({
            type:"post",
            url:"user/r1",
            data:{

                name:$("#userName").val(),
                password:$("#password").val()
            },

            success:function(result){
                if(result){
                    location.href="bookList.html";
                }else{
                    alert("登陆错误");
                }
            }


        });

    }
</script>
</body>

</html>